using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class TransferMap : EntityTypeConfiguration<Transfer>
    {
        public TransferMap()
        {
            // Primary Key
            this.HasKey(t => t.NUmber);

            // Properties
            this.Property(t => t.Note)
                .HasMaxLength(50);

            this.Property(t => t.USERNO)
                .HasMaxLength(10);

            this.Property(t => t.TransferType)
                .HasMaxLength(3);

            this.Property(t => t.SOURCE)
                .IsRequired()
                .HasMaxLength(3);

            this.Property(t => t.DEST)
                .IsRequired()
                .HasMaxLength(3);

            this.Property(t => t.File_Primary_Key)
                .HasMaxLength(10);

            this.Property(t => t.custid)
                .HasMaxLength(6);

            // Table & Column Mappings
            this.ToTable("Transfer");
            this.Property(t => t.NUmber).HasColumnName("NUmber");
            this.Property(t => t.Note).HasColumnName("Note");
            this.Property(t => t.date).HasColumnName("date");
            this.Property(t => t.USERNO).HasColumnName("USERNO");
            this.Property(t => t.TransferType).HasColumnName("TransferType");
            this.Property(t => t.SOURCE).HasColumnName("SOURCE");
            this.Property(t => t.DEST).HasColumnName("DEST");
            this.Property(t => t.POsted).HasColumnName("POsted");
            this.Property(t => t.OUTTRANSFERNUM).HasColumnName("OUTTRANSFERNUM");
            this.Property(t => t.File_Primary_Key).HasColumnName("File Primary Key");
            this.Property(t => t.Mode).HasColumnName("Mode");
            this.Property(t => t.custid).HasColumnName("custid");
            this.Property(t => t.PSID).HasColumnName("PSID");
        }
    }
}
